﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DimOS.Constants;

namespace DimOS.Plugs
{
    public static class Char
    {
        public static char ToLower(char character)
        { if ('A' <= character && character <= 'Z') character =
          (System.Char)(character | 0x20); return character; }

        public static char ToUpper(char character)
        { if ('a' <= character && character <= 'z') character =
          (System.Char)(character & ~0x20); return character; }

        public static bool IsDigit(char character)
        { return (character >= '0' && character <= '9'); }

        public static bool IsLetter(char character)
        { character |= (char)0x20; return (character >= 'a' && character <= 'z'); }

        public static bool IsLetterOrDigit(char character)
        { return IsLetter(character) || IsDigit(character);}

        public static bool IsWhiteSpace(char character)
        { if (character == Tokens.Space || (character >= '\x0009' && character <= '\x000d')
          || character == '\x00a0' || character == '\x0085') return true; return false; }
    }
}
